#include "GY_PenWidget.h"

GY_PenWidget::GY_PenWidget(QWidget *parent)
    :QLineEdit(parent), m_index(0)
{
//    m_pLabel = new QLabel();
    m_pPenCssLabel = new GY_PenWidth();

//    m_pLabel->setFixedSize(12,12);

    QHBoxLayout* pLayout = new QHBoxLayout();
//    pLayout->addWidget(m_pLabel);
    pLayout->addWidget(m_pPenCssLabel);
    pLayout->setMargin(2);
    setLayout(pLayout);
    setReadOnly(true);
}

GY_PenWidget::~GY_PenWidget()
{

}

void GY_PenWidget::updataPen(const int &index, const int &type)
{
    m_index = index;
//    m_type = type;

    QString strText = QString("%1)").arg(QString::number(m_index));
//    m_pLabel->setText(strText);
    m_pPenCssLabel->setDrawParameters(type,index);
}

void GY_PenWidget::mousePressEvent(QMouseEvent *event)
{
    emit sendClicked(m_index);
}
